package cn.chenmixuexi.protocol.serializer;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public abstract class Serializer {
    public abstract <T> T deserialize(Class<T> clazz, byte[] bytes);
    public abstract <T> byte[] serialize(T obj) throws IOException;
    public abstract int getId();

    public static final int Java = 0;
    public static final int Json = 1;
    public static final Map<Integer, Class<?>> serializerClasses = new HashMap<>();

    static {
        serializerClasses.put(Java, JDKSerializer.class);
        serializerClasses.put(Json, JSONSerializer.class);
    }
}
